import { PCFSoftShadowMap, WebGLRenderer } from "three";

const renderer = new WebGLRenderer({
  antialias: true,
});
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = PCFSoftShadowMap;
renderer.setPixelRatio(window.devicePixelRatio);
const mainCanvas = renderer.domElement;


function setCanvasSize() {
  renderer.setSize(window.innerWidth, window.innerHeight);
  mainCanvas.width = window.innerWidth;
  mainCanvas.height = window.innerHeight;
  mainCanvas.style.width = window.innerWidth + 'px';
  mainCanvas.style.height = window.innerHeight + 'px';
  mainCanvas.style.position = 'relative';
  mainCanvas.style.zIndex = "100";
}
setCanvasSize();

document.body.appendChild(renderer.domElement);
window.addEventListener("resize", function () {
  setCanvasSize();
});


export { renderer, mainCanvas, setCanvasSize };

